package com.example.administrator.dc.fragment;


import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.administrator.dc.Bean.Clubintro;
import com.example.administrator.dc.Bean.Clublist;
import com.example.administrator.dc.Bean.Dataintro;
import com.example.administrator.dc.Bean.Dataphoto;
import com.example.administrator.dc.R;
import com.example.administrator.dc.adapter.ClubIntroduceAdapter;
import com.example.administrator.dc.adapter.ClubListAdapter;
import com.example.administrator.dc.model.ClubModel;
import com.example.administrator.dc.model.ListModel;

import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * A simple {@link Fragment} subclass.
 */
public class ClubIntroduce extends BaseFragment{
   private TextView Content;
    private TextView tellContent;
    private RecyclerView clubintro;
    public List<Dataintro> Datalist;

    public ClubIntroduce() {
        // Required empty public constructor
    }
    public void onViewCreated(View view,@Nullable Bundle savedInstanceState) {
        clubintro= (RecyclerView) view.findViewById(R.id.intro);
        Content= (TextView) view.findViewById(R.id.introduceContent);
        tellContent= (TextView) view.findViewById(R.id.tellContent);
        clubintro.setLayoutManager(new LinearLayoutManager(this.getActivity()));
        ClubModel  listModel=new ClubModel();
        String str = String.valueOf(getCid());
        Call<Clubintro> call=listModel.Club(str);
        call.enqueue(new Callback<Clubintro>() {
            @Override
            public void onResponse(Call<Clubintro> call, Response<Clubintro> response) {
               Content.setText(response.body().getIntroduction());
                tellContent.setText(response.body().getClub_tel());
                Datalist=response.body().getClubteacher();
                clubintro.setAdapter(new ClubIntroduceAdapter(getActivity(),Datalist));
            }

            @Override
            public void onFailure(Call<Clubintro> call, Throwable t) {

            }
        });


    }




    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_club_introduce, container, false);
    }

}

